$OpenBSD: patch-wrlib_gif_c,v 1.3 2015/03/29 10:44:55 sthen Exp $

handle giflib 5.0+

--- wrlib/gif.c.orig	Tue Oct 12 19:21:01 2004
+++ wrlib/gif.c	Sun Mar 29 11:44:15 2015
@@ -49,6 +49,7 @@ RLoadGIF(RContext *context, char *file, int index)
     GifPixelType *buffer = NULL;
     int i, j, k;
     int width, height;
+    int giferr = 0;
     GifRecordType recType;
     ColorMapObject *colormap;
     unsigned char rmap[256];
@@ -61,10 +62,10 @@ RLoadGIF(RContext *context, char *file, int index)
     /* default error message */
     RErrorCode = RERR_BADINDEX;
 
-    gif = DGifOpenFileName(file);
+    gif = DGifOpenFileName(file, &giferr);
 
     if (!gif) {
-        switch (GifLastError()) {
+        switch (giferr) {
         case D_GIF_ERR_OPEN_FAILED:
             RErrorCode = RERR_OPEN;
             break;
@@ -79,7 +80,7 @@ RLoadGIF(RContext *context, char *file, int index)
     }
 
     if (gif->SWidth<1 || gif->SHeight<1) {
-        DGifCloseFile(gif);
+        DGifCloseFile(gif, NULL);
         RErrorCode = RERR_BADIMAGEFILE;
         return NULL;
     }
@@ -202,7 +203,7 @@ RLoadGIF(RContext *context, char *file, int index)
     /* yuck! */
     goto did_not_get_any_errors;
 giferr:
-    switch (GifLastError()) {
+    switch (gif->Error) {
     case D_GIF_ERR_OPEN_FAILED:
         RErrorCode = RERR_OPEN;
         break;
@@ -223,7 +224,7 @@ did_not_get_any_errors:
         free(buffer);
 
     if (gif)
-        DGifCloseFile(gif);
+        DGifCloseFile(gif, NULL);
 
     return image;
 }
